package com.yanmaohu.nikita.data.structure;

import java.util.List;

/**
 * @author Bright Lee
 */
public final class MemberModifier {

    private int beginIndex;
    private int endIndex;
    private boolean _mutable;
    private List<Boolean> arrayMutableList;
    private boolean _protected;
    private boolean _public;

    public MemberModifier(int beginIndex, int endIndex, boolean _mutable, List<Boolean> arrayMutableList, boolean _protected, boolean _public) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
        this._mutable = _mutable;
        this.arrayMutableList = arrayMutableList;
        this._protected = _protected;
        this._public = _public;
    }

    public int beginIndex() {
        return beginIndex;
    }

    public int endIndex() {
        return endIndex;
    }

    public boolean isMutable() {
        return _mutable == true;
    }

    public boolean isMutable(int index) {
        if (arrayMutableList == null || arrayMutableList.isEmpty()) {
            return false;
        }
        Boolean arrayMutable = arrayMutableList.get(index);
        return arrayMutable != null && arrayMutable == false;
    }

    public boolean isPrivate() {
        return !isProtected() && !isPublic();
    }

    public boolean isProtected() {
        return _protected;
    }

    public boolean isPublic() {
        return _public;
    }

}
